$(function(){
	$('.car_use').on('click', function() {
		if($('.company_type').val()==0){
			choosecar("{:url('used/index',['op'=>'search'])}")
		}else{
			choosecar("{:url('used/index',['op'=>'search'])}?company_type="+$('.company_type').val())
		}
	});
	$('.limit').on('click',function(){
		var limiturl="{:url('limit',['op'=>'search'])}?car_use_id="+$(this).closest('tr').data('id')
		console.log(limiturl)
		layer.open({
		  type: 2,
		  title: '请选择',
		  shadeClose: true,
		  shade: 0.8,
		  area: ['80%', '70%'],
		  content: limiturl //iframe的url
		}); 
	
	})
	$('input[type=checkbox]').on('click',function(){
		checkall(this)
	})
	$('.limit_change').on('click',function(){
		
			layer.open({
				type: 1,
				id: "delect" 
					,
				content: "<input type='text' class='chang_main' style='margin-left:5px'/>",
				btn: ['确定', '取消'],
				btnAlign: 'c' //按钮居中
					,
				shade: 0 //不显示遮罩
					,
				yes: function() {
					var arr=[];
					var arr2=[]
					for(var i=0;i<$('table tbody input[type=checkbox]').length;i++){
						if($('table tbody input[type=checkbox]')[i].checked){
							arr.push($('table tbody input[type=checkbox]').eq(i).closest('tr').data('id'))
							arr2.push(i)
							
						}
					}
					$.ajax({
						type:post,
						data:arr,
						url:"",
						success:function(res){
							console.log()
							if(res.code==1){
								for(var j=0;j<arr2.length;j++){
									$('table tbody .limit_list').eq(j).html($(".chang_main").val())
								}
							}
						}
					})
//					console.log(arr)
				},
				btn2: function() {
					layer.closeAll();
				}
		});
	});
})
